<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;

class CartResource extends JsonResource
{
    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'cart_id' => $this->id,
            'product_sku_id' => $this->product_sku_id,
            'product_id' => $this->product_id,
            'title' =>  $this->product_title,
            'amount' => $this->amount,
            'total' => $this->total,
            'price' => $this->productSku->price,
            'stock' => $this->productSku->stock,
            'on_sale' => $this->on_sale,
            'image' => $this->product_image,
            'spec_sku_name' => $this->spec_sku_name
        ];
    }
}
